********************************************************************************
********************************************************************************
* QUINLAN, SCHNAUDT, & LEWIS-BECK
* FORECASTING BLOC SUPPORT IN GERMAN FEDERAL ELECTIONS: A POLITCAL HISTORY MODEL 
* ANALYSIS SYNTAX FILE (Including analysis in the paper appendix)
* Last updated: Wednesday June 16, 2021
********************************************************************************
********************************************************************************

********************************************************************************
********************************************************************************
* SYNTAX FILE TABLE OF CONTENTS
* #>>>  1: INSTRUCTIONS FOR USE OF SYNTAX FILE, PURPOSE OF SYNTAX FILE
**         GET DATA, & STATA SETUP FOR TIME SERIES 
* #>>>  2: SUMMARY STATS OF RELEVANT VARIABLES AND PLOTS
* #>>>  3: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION
**#>>>  4: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION 
**         OUT-OF-SAMPLE DIAGNOSTICS - JACKKNIFE APPROACH
**#>>>  5: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION 
**         OUT-OF-SAMPLE DIAGNOSTICS - STEP AHEAD FORECASTS 
* #>>>  6: VOTE SHARE MODELS - INDIVIDUAL MODELS     
**#>>>  7: ROBUSTNESS CHECKS - NAIVE VOTE SHARE MODELS - SEEMINGLY UNRELATED 
**         REGRESSION
**#>>>  8: ROBUSTNESS CHECKS - VOTE SHARE MODELS - INDIVIDUAL OLS MODELS
********************************************************************************
********************************************************************************


********************************************************************************
********************************************************************************
**#>>> 1: INSTRUCTIONS FOR USE OF SYNTAX FILE, PURPOSE OF SYNTAX FILE
**        GET DATA, & STATA SETUP FOR TIME SERIES 
********************************************************************************
********************************************************************************

********************************************************************************
** >>> INSTRUCTIONS FOR USE OF AND NAVIGATING FILE
********************************************************************************
* #>>>  = SECTION HEADER 
* ///   = ANALYSIS HEADER
**************************************************************************** 


********************************************************************************
** >>> PURPOSE OF FILE
********************************************************************************
* This do-file serves to operationalize and append a series of variables relevant
* to the analysis reported in Quinlan, Schnaudt, and Lewis-Beck paper 
* "FORECASTING BLOC SUPPORT IN GERMAN FEDERAL ELECTIONS: A POLITCAL HISTORY 
* MODEL" 


********************************************************************************
** >>> SETUP STATA, GET DATA, AND SETUP FOR TIME SERIES
********************************************************************************

/// Make sure no other data in STATA 
clear all 


/// Open Dataset (ACHTUNG: May require path change)
use "C:\Users\quinlasn\Desktop\Forecasting\Germany\Data\20210615_Dataverse\Q_S_LB_German Forecast Data 1953-2017.dta"


/// Set time variable 
tset ElectionID


********************************************************************************
********************************************************************************
**#>>> 2: SUMMARY STATS OF RELEVANT VARIABLES AND PLOTS
********************************************************************************
********************************************************************************

********************************************************************************
** >>> SUMMARY STATISTICS 
********************************************************************************

// Summary stats (Table A1, Appendix A)
sum ZS_Union ZS_Union_PrevElec ZS_CDU ZS_CSU ZS_CDU_PrevElec ZS_CSU_PrevElec ZS_FDP Election_Post90a InGovt_GroKo Land_InGovt_Union_MP ZS_SPD ZS_SPD_PrevElec Land_InGovt_SPD_MP ZS_Others3 ZS_Others3_PrevElec Land_InGovt_Others3_MP ZS_SPD ZS_SPD_PrevElec StpAhead_Election_94 StpAhead_Election_98 StpAhead_Election_02 StpAhead_Election_05 StpAhead_Election_09 StpAhead_Election_13 StpAhead_Election_17


********************************************************************************
** >>>  PLOTS
********************************************************************************

///Plot: UNION ZS Vote Share (Figure A1, Appendix A)
graph twoway (lfit ZS_Union ElectionDate_Y) (scatter ZS_Union ElectionDate_Y)


///Plot: SPD ZS Vote Share (Figure A2, Appendix A)
graph twoway (lfit ZS_SPD ElectionDate_Y) (scatter ZS_SPD ElectionDate_Y)


///Plot: OTHERS Vote Share (Figure A3, Appendix A)
graph twoway (lfit ZS_Others3 ElectionDate_Y) (scatter ZS_Others3 ElectionDate_Y)


///Plot: FDP ZS Vote Share (Figure A4, Appendix A)
graph twoway (lfit ZS_FDP ElectionDate_Y) (scatter ZS_FDP ElectionDate_Y)


********************************************************************************
********************************************************************************
**#>>> 3: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION
********************************************************************************
********************************************************************************

///  Regression Model
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP)
estat ic                                                                        //* Information Criteria for Model Comparison


/// Calculate predicted ZS values for UNION with 95% Confidence Intervals 
predict ZS_Union_yhat, xb equation(ZS_Union)                                    //* Predict ZS UNION Vote Share
predict ZS_Union_errorPRED, stdp  equation(ZS_Union)                            //* Predict Standard Error of the Prediction UNION Model
generate ZS_Union_yhatlb = ZS_Union_yhat - invnormal(0.975)*ZS_Union_errorPRED  //* Predict ZS UNION Vote Share Confidence Interval Lower Bound
generate ZS_Union_yhatub = ZS_Union_yhat + invnormal(0.975)*ZS_Union_errorPRED  //* Predict ZS UNION Vote Share Confidence Interval Upper Bound


/// Predicted ZS values for UNION with 95% Confidence Intervals by Election Year
tabstat ZS_Union_yhat, by(ElectionDate)                                         //* Predicted ZS UNION Vote Share by Election Year (See Table C1, Appendix C)
tabstat ZS_Union_errorPRED, by(ElectionDate)                                    //* PredictedStandard Error of the Prediction UNION Model by Election Year
tabstat ZS_Union_yhatlb, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share CI Lower Bound by Election Year
tabstat ZS_Union_yhatub, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share CI Upper Bound by Election Year


/// Calculate predicted ZS values for SPD with 95% Confidence Intervals
predict ZS_SPD_yhat, xb equation(ZS_SPD)                                        //* Predict ZS SPD Vote Share
predict ZS_SPD_errorPRED, stdp  equation(ZS_SPD)                                //* Predict Standard Error of the Prediction SPD Model
generate ZS_SPD_yhatlb = ZS_SPD_yhat - invnormal(0.975)*ZS_SPD_errorPRED        //* Predict ZS SPD Vote Share Confidence Interval Lower Bound
generate ZS_SPD_yhatub = ZS_SPD_yhat + invnormal(0.975)*ZS_SPD_errorPRED        //* Predict ZS SPD Vote Share Confidence Interval Upper Bound


/// Predicted ZS values for SPD with 95% Confidence Intervals by Election Year
tabstat ZS_SPD_yhat, by(ElectionDate)                                           //* Predicted ZS SPD Vote Share by Election Year (See Table C2, Appendix C)
tabstat ZS_SPD_errorPRED, by(ElectionDate)                                      //* PredictedStandard Error of the Prediction SPD Model by Election Year
tabstat ZS_SPD_yhatlb, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share CI Lower Bound by Election Year
tabstat ZS_SPD_yhatub, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share CI Upper Bound by Election Year


/// Calculate predicted ZS values for OTHERS3 with 95% Confidence Intervals
predict ZS_OTH3_yhat, xb equation(ZS_Others3)                                   //* Predict ZS OTHERS Vote Share
predict ZS_OTH3_errorPRED, stdp  equation(ZS_Others3)                           //* Predict Standard Error of the Prediction OTHERS Model
generate ZS_OTH3_yhatlb = ZS_OTH3_yhat - invnormal(0.975)*ZS_OTH3_error         //* Predict ZS OTHERS Vote Share Confidence Interval Lower Bound
generate ZS_OTH3_yhatub = ZS_OTH3_yhat + invnormal(0.975)*ZS_OTH3_error         //* Predict ZS OTHERS Vote Share Confidence Interval Upper Bound


/// Predicted ZS values for OTHERS3 with 95% Confidence Intervals by Election Year
tabstat ZS_OTH3_yhat, by(ElectionDate)                                          //* Predicted ZS OTHERS Vote Share by Election Year (See Table C3, Appendix C)
tabstat ZS_OTH3_errorPRED, by(ElectionDate)                                     //* PredictedStandard Error of the Prediction SPD Model by Election Year
tabstat ZS_OTH3_yhatlb, by(ElectionDate)                                        //* Predicted ZS OTHERS Vote Share CI Lower Bound by Election Year
tabstat ZS_OTH3_yhatub, by(ElectionDate)                                        //* Predicted ZS OTHERS Vote Share CI Upper Bound by Election Year


********************************************************************************
********************************************************************************
**#>>> 4: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION 
**        OUT-OF-SAMPLE DIAGNOSTICS - JACKKNIFE APPROACH
********************************************************************************
********************************************************************************

/// SUR Model (Jacknife test excl 2017, Election ID=19)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18        

predict ZS_Union_yhat_JN2017, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2017
tabstat ZS_Union_yhat_JN2017, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2017 by Election Year

predict ZS_SPD_yhat_JN2017, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2017
tabstat ZS_SPD_yhat_JN2017, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2017 by Election Year

predict ZS_OTH3_yhat_JN2017, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2017 
tabstat ZS_OTH3_yhat_JN2017, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2017 by Election Year



/// SUR Model (Jacknife test excl 2013, Election ID=18)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 19        

predict ZS_Union_yhat_JN2013, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2013
tabstat ZS_Union_yhat_JN2013, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2013 by Election Year

predict ZS_SPD_yhat_JN2013, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2013
tabstat ZS_SPD_yhat_JN2013, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2013 by Election Year

predict ZS_OTH3_yhat_JN2013, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2013 
tabstat ZS_OTH3_yhat_JN2013, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2013 by Election Year



/// SUR Model (Jacknife test excl 2009, Election ID=17)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN2009, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2009
tabstat ZS_Union_yhat_JN2009, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2009 by Election Year

predict ZS_SPD_yhat_JN2009, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2009
tabstat ZS_SPD_yhat_JN2009, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2009 by Election Year

predict ZS_OTH3_yhat_JN2009, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2009 
tabstat ZS_OTH3_yhat_JN2009, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2009 by Election Year



/// SUR Model (Jacknife test excl 2005, Election ID=16)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN2005, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2005
tabstat ZS_Union_yhat_JN2005, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2005 by Election Year

predict ZS_SPD_yhat_JN2005, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2005
tabstat ZS_SPD_yhat_JN2005, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2005 by Election Year

predict ZS_OTH3_yhat_JN2005, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2005 
tabstat ZS_OTH3_yhat_JN2005, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2005 by Election Year



/// SUR Model (Jacknife test excl 2002, Election ID=15)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN2002, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2002
tabstat ZS_Union_yhat_JN2002, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2002 by Election Year

predict ZS_SPD_yhat_JN2002, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2002
tabstat ZS_SPD_yhat_JN2002, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2002 by Election Year

predict ZS_OTH3_yhat_JN2002, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2002 
tabstat ZS_OTH3_yhat_JN2002, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2002 by Election Year



/// SUR Model (Jacknife test excl 1998, Election ID=14)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1998, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1998
tabstat ZS_Union_yhat_JN1998, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1998 by Election Year

predict ZS_SPD_yhat_JN1998, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1998
tabstat ZS_SPD_yhat_JN1998, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1998 by Election Year

predict ZS_OTH3_yhat_JN1998, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1998
tabstat ZS_OTH3_yhat_JN1998, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1998 by Election Year


/// SUR Model (Jacknife test excl 1994, Election ID=13)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1994, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1994
tabstat ZS_Union_yhat_JN1994, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1994 by Election Year

predict ZS_SPD_yhat_JN1994, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1994
tabstat ZS_SPD_yhat_JN1994, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1994 by Election Year

predict ZS_OTH3_yhat_JN1994, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1994
tabstat ZS_OTH3_yhat_JN1994, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1994 by Election Year



/// SUR Model (Jacknife test excl 1990, Election ID=12)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1990, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1990
tabstat ZS_Union_yhat_JN1990, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1994 by Election Year

predict ZS_SPD_yhat_JN1990, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1990
tabstat ZS_SPD_yhat_JN1990, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1990 by Election Year

predict ZS_OTH3_yhat_JN1990, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1990
tabstat ZS_OTH3_yhat_JN1990, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1990 by Election Year



/// SUR Model (Jacknife test excl 1987, Election ID=11)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1987, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1987
tabstat ZS_Union_yhat_JN1987, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1987 by Election Year

predict ZS_SPD_yhat_JN1987, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1987
tabstat ZS_SPD_yhat_JN1987, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1987 by Election Year

predict ZS_OTH3_yhat_JN1987, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1987
tabstat ZS_OTH3_yhat_JN1987, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1987 by Election Year


/// SUR Model (Jacknife test excl 1983, Election ID=10)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1983, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1983
tabstat ZS_Union_yhat_JN1983, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1983 by Election Year

predict ZS_SPD_yhat_JN1983, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1983
tabstat ZS_SPD_yhat_JN1983, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1983 by Election Year

predict ZS_OTH3_yhat_JN1983, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1983
tabstat ZS_OTH3_yhat_JN1983, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1983 by Election Year



/// SUR Model (Jacknife test excl 1980, Election ID=9)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1980, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1980
tabstat ZS_Union_yhat_JN1980, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1980 by Election Year

predict ZS_SPD_yhat_JN1980, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1980
tabstat ZS_SPD_yhat_JN1980, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1980 by Election Year

predict ZS_OTH3_yhat_JN1980, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1980
tabstat ZS_OTH3_yhat_JN1980, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1980 by Election Year



/// SUR Model (Jacknife test excl 1976, Election ID=8)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1976, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1976
tabstat ZS_Union_yhat_JN1976, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1976 by Election Year
 
predict ZS_SPD_yhat_JN1976, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1976
tabstat ZS_SPD_yhat_JN1976, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1976 by Election Year

predict ZS_OTH3_yhat_JN1976, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1976
tabstat ZS_OTH3_yhat_JN1976, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1976 by Election Year


/// SUR Model (Jacknife test excl 1972, Election ID=7)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1972, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1972
tabstat ZS_Union_yhat_JN1972, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1972 by Election Year

predict ZS_SPD_yhat_JN1972, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1972
tabstat ZS_SPD_yhat_JN1972, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1972 by Election Year

predict ZS_OTH3_yhat_JN1972, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1972
tabstat ZS_OTH3_yhat_JN1972, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1972 by Election Year



/// SUR Model (Jacknife test excl 1969, Election ID=6)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1969, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1969
tabstat ZS_Union_yhat_JN1969, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1969 by Election Year

predict ZS_SPD_yhat_JN1969, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1969
tabstat ZS_SPD_yhat_JN1969, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1969 by Election Year

predict ZS_OTH3_yhat_JN1969, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1969
tabstat ZS_OTH3_yhat_JN1969, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1969 by Election Year



/// SUR Model (Jacknife test excl 1965, Election ID=5)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1965, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1965
tabstat ZS_Union_yhat_JN1965, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1965 by Election Year

predict ZS_SPD_yhat_JN1965, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1965
tabstat ZS_SPD_yhat_JN1965, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1965 by Election Year

predict ZS_OTH3_yhat_JN1965, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1965
tabstat ZS_OTH3_yhat_JN1965, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1965 by Election Year


/// SUR Model (Jacknife test excl 1961, Election ID=4)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 3 | ElectionID == 5 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1961, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1961
tabstat ZS_Union_yhat_JN1961, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1961 by Election Year

predict ZS_SPD_yhat_JN1961, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1961
tabstat ZS_SPD_yhat_JN1961, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1961 by Election Year

predict ZS_OTH3_yhat_JN1961, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1961
tabstat ZS_OTH3_yhat_JN1961, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1961 by Election Year



/// SUR Model (Jacknife test excl 1957, Election ID=3)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 2 | ElectionID == 4 | ElectionID == 5 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1957, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1957
tabstat ZS_Union_yhat_JN1957, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1957 by Election Year

predict ZS_SPD_yhat_JN1957, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1957
tabstat ZS_SPD_yhat_JN1957, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1957 by Election Year

predict ZS_OTH3_yhat_JN1957, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1957
tabstat ZS_OTH3_yhat_JN1957, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1957 by Election Year



/// SUR Model (Jacknife test excl 1953, Election ID=2)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if ElectionID == 3 | ElectionID == 4 | ElectionID == 5 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN1953, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1953
tabstat ZS_Union_yhat_JN1953, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1953 by Election Year

predict ZS_SPD_yhat_JN1953, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1957
tabstat ZS_SPD_yhat_JN1953, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1957 by Election Year

predict ZS_OTH3_yhat_JN1953, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1957
tabstat ZS_OTH3_yhat_JN1953, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1957 by Election Year


********************************************************************************
********************************************************************************
**#>>> 5: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION 
**        OUT-OF-SAMPLE DIAGNOSTICS - STEP AHEAD FORECASTS 
**        Please note: only carried out from 1994 onwards
********************************************************************************
********************************************************************************

/// SUR Model (Step-Ahead Forecast: 2017 (Data: 1953-2013 for a 2017 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_17==1        

predict ZS_Union_yhat_StepAllbt17, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt17, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt17, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt17, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt17, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt17, by(ElectionDate)


/// SUR Model (Step-Ahead Forecast: 2013 (Data: 1953-2009 for a 2013 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_13==1        

predict ZS_Union_yhat_StepAllbt13, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt13, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt13, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt13, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt13, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt13, by(ElectionDate)



/// SUR Model (Step-Ahead Forecast: 2009 (Data: 1953-2005 for a 2009 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_09==1        

predict ZS_Union_yhat_StepAllbt09, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt09, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt09, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt09, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt09, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt09, by(ElectionDate)



/// SUR Model (Step-Ahead Forecast: 2005 (Data: 1953-2002 for a 2005 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_05==1        

predict ZS_Union_yhat_StepAllbt05, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt05, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt05, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt05, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt05, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt05, by(ElectionDate)



/// SUR Model (Step-Ahead Forecast: 2002 (Data: 1953-1998 for a 2002 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_02==1        

predict ZS_Union_yhat_StepAllbt02, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt02, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt02, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt02, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt02, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt02, by(ElectionDate)


/// SUR Model (Step-Ahead Forecast: 1998 (Data: 1953-1994 for a 1998 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_98==1        

predict ZS_Union_yhat_StepAllbt98, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt98, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt98, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt98, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt98, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt98, by(ElectionDate)



/// SUR Model (Step-Ahead Forecast: 1994 (Data: 1953-1990 for a 1994 forecast)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP) if StpAhead_Election_94==1        

predict ZS_Union_yhat_StepAllbt94, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt94, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt94, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt94, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt94, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt94, by(ElectionDate)



********************************************************************************
********************************************************************************
**#>>> 6: ROBUSTNESS CHECKS - VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION
**        CDU AND CSU AS SEPARATE
**        TABLE C4, APPENDIX C
********************************************************************************
********************************************************************************

///  Regression Model
sureg (ZS_CDU ZS_CDU_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP) (ZS_CSU ZS_CSU_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP) (ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP)
estat ic


********************************************************************************
********************************************************************************
**#>>> 7: ROBUSTNESS CHECKS - NAIVE VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION
**        TABLE C5, APPENDIX C
********************************************************************************
********************************************************************************

///  Regression Model
sureg (ZS_Union ZS_Union_PrevElec) (ZS_SPD ZS_SPD_PrevElec )( ZS_Others3 ZS_Others3_PrevElec)
estat ic


/// Calculate predicted ZS values for UNION with 95% Confidence Intervals: NAIVE MODELS
predict ZS_UnionNM_yhat, xb equation(ZS_Union)                                  //* Predict ZS UNION Vote Share
tabstat ZS_UnionNM_yhat, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share by Election Year


/// Calculate predicted ZS values for SPD with 95% Confidence Intervals: NAIVE MODELS
predict ZS_SPDNM_yhat, xb equation(ZS_SPD)                                      //* Predict ZS SPD Vote Share
tabstat ZS_SPDNM_yhat, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share by Election Year


/// Calculate predicted ZS values for OTHERS3 with 95% Confidence Intervals: NAIVE MODELS
predict ZS_OTH3NM_yhat, xb equation(ZS_Others3)                                 //* Predict ZS OTHERS3 Vote Share
tabstat ZS_OTH3NM_yhat, by(ElectionDate)                                        //* Predicted ZS OTHERS3 Vote Share by Election Year


********************************************************************************
********************************************************************************
**#>>> 8: ROBUSTNESS CHECKS - VOTE SHARE MODELS - INDIVIDUAL OLS MODELS
********************************************************************************
********************************************************************************

///  Regression Model: UNION
reg ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP
estat ic
estat vif
estat dwatson
*predict cooksd if e(sample), cooksd
*graph bar (asis) cooksd, over(ElectionID)


///  Regression Model: SPD
reg ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP
estat ic 
estat vif
estat dwatson
*predict cooksd if e(sample), cooksd
*graph bar (asis) cooksd, over(ElectionID)


///  Regression Model: OTHERS (FDP, Green, and all others)
reg ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP
estat ic
estat vif
estat dwatson
*predict cooksd if e(sample), cooksd
*graph bar (asis) cooksd, over(ElectionID)



***// END OF FILE




